package com.sx.micowell.framework.adapter

import android.content.Context
import androidx.core.view.isVisible
import androidx.recyclerview.widget.DiffUtil
import androidx.recyclerview.widget.RecyclerView
import com.kunminx.binding_recyclerview.adapter.SimpleDataBindingAdapter
import com.miloyu.modelnet.response.CourseInfo
import com.sx.micowell.R
import com.sx.micowell.databinding.ItemRecommendCourseBinding
import com.sx.micowell.framework.tools.DiffUtils

/**
 * @Description 课程列表
 * @Author 梁浩文
 * @Date 2021/8/25 9:54
 */
class CourseListAdapter(
    context: Context?) : SimpleDataBindingAdapter<CourseInfo, ItemRecommendCourseBinding>(
    context,
    R.layout.item_recommend_course,
    DiffUtils.getInstance().courseInfoItemCallback
) {
    override fun onBindItem(
        binding: ItemRecommendCourseBinding?,
        item: CourseInfo?,
        holder: RecyclerView.ViewHolder?
    ) {
        binding?.data=item
        binding?.imageVip?.isVisible = item?.isVip == "Y"
    }
}